import React from 'react';
import { Tools,Icon} from 'weaver-mobile';
import '../../style/listicon/index.less'
const getLabel = Tools.getLabel;

const statusIconMap = {
  "1": {
    class: "in-progress",
    color: "#469AFF"
  },
  "2": {
    class: "check-circle",
    color: "#52c41a"
  },
  "3": {
    class: "revocation",
    color: "rgb(203, 205, 206)"
  },
  "4": {
    class: "blog-chidao",
    color: "#eaa81c"
  },
  "5": {
    class: "blog-weitijiao",
    color: "#d81d19"
  },
  "6": {
    class: "flow",
    color: "rgb(241, 2, 46)"
  },
}

class ListIcon extends React.Component {
    constructor(props){
        super(props);
        this.state = { ...props }
    }

    componentWillReceiveProps (newProps) {
      this.setState({
        ...newProps
      })
    }

    getIcon (type) {
        let icon = statusIconMap[type]
        return icon ? <Icon type={icon.class} style={{ color: icon.color }} /> : ""
    }

    render(){
      let {type = "progress"} = this.state;
      return (
        <div className="workrelate_mobile_List_icon">{this.getIcon(type)}</div>
      )
    }

}

export default ListIcon;